<%@page import="model.Billet"%>
<%@page import="model.Utilisateur"%>
<%@page import="dao.DaoBillet"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.List"%>

<% if((Utilisateur)session.getAttribute("user_connected") != null ){ %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
	<title>Achat et vente de billets</title>
	<link rel="stylesheet" href="css/style.css" type="text/css" media="all" />
	<!--[if lte IE 6]><link rel="stylesheet" href="css/ie6.css" type="text/css" media="all" /><![endif]-->
	
	<meta name="keywwords" content="Shop Around - Great free html template for on-line shop. Use it as a start point for your on line business. The template can be easily implemented in many open source E-commerce platforms" />
	<meta name="description" content="Shop Around - Great free html template for on-line shop. Use it as a start point for your on line business. The template can be easily implemented in many open source E-commerce platforms" />
	
	<!-- JS -->
	<script src="js/jquery-1.4.1.min.js" type="text/javascript"></script>	
	<script src="js/jquery.jcarousel.pack.js" type="text/javascript"></script>	
	<script src="js/jquery-func.js" type="text/javascript"></script>	
	<!-- End JS -->
	
</head>
<body>
	
<!-- Shell -->	
<div class="shell">
	
	<!-- Header -->	
	<%@ include file="header.jsp" %>
	
	<!-- Main -->
	<div id="main">		
		<!-- Principal -->
		<div id="principal">
			<br />
			<h1>Mes ventes</h1><br/>
		
			<div class="billet-info">
	    		<div class="billet-desc" style="padding-left: 40px;">
	    		
	    			<% 
	    				DaoBillet daobillet = new DaoBillet();
	    				int userid = Integer.parseInt(request.getParameter("cpt_id").trim());
	    				ArrayList<Billet> listeBillet = (ArrayList<Billet>)daobillet.getBilletByUser(userid);
						if(listeBillet == null){
	    			%>
	    			
	    			
	    			<%}else{ %>
	    			
	    			<table cstyle="" align="center" cellspacing="20">						
						<tr>
							<td><h2>Ville Depart</h2></td>
							<td><h2>Ville arrivee</h2></td>
							<td><h2>Date Depart</h2></td>
							<td><h2>Heure Depart</h2></td>
							<td><h2>Prix</h2></td>
						</tr>
						<% for(Billet billet : listeBillet){ %>
						<tr>								
							<td><h3><%= billet.getVilleDepart() %></h3></td>
							<td><h3><%= billet.getVilleArrivee() %></h3></td>
							<td><h3><%= billet.getDateDepart() %></h3></td>
							<td><h3><%= billet.getHeureDepart() %></h3></td>
							<td><h3><%= billet.getPrixVente() %></h3></td>							
						</tr>
						<%}%>
					</table>
					<%} %>
	    				    			
				</div>
			</div>	
			
		</div>
		<!-- End Content -->
		
		<!-- Sidebar -->
		<div id="sidebar">
			
			<!-- Search -->
			<%@ include file="search.jsp" %>
			
			<!-- Menus -->
			<%@ include file="menus_user.jsp" %>
			
		</div>
		<!-- End Sidebar -->
		
		<div class="cl">&nbsp;</div>
	</div>
	<!-- End Main -->
	
	<!-- Side Full -->
	<%@ include file="foot_slide.jsp" %>
	
	<!-- Footer -->
	<%@ include file="footer.jsp" %>

</div>	
<!-- End Shell -->
	
</body>
</html>
<%} else { response.sendRedirect("index.jsp"); } %>